package com.wzdigit.wms.basic.enums.workdivision;


import com.wzdigit.wms.basic.enums.BaseEnum;

import java.util.*;

/**
 * 是否启用
 * @author yangdongjie
 * @GdnDtlStatusEnum.java
 * @2021年2月23日下午1:54:19
 */
public enum WorkDivisionIsEnabledEnum implements BaseEnum {

	NO(0, "否", "WorkDivisionIsEnabled"), 
	YES(1, "是", "WorkDivisionIsEnabled");
	
	/**
	 * 枚举值
	 */
	public Integer code;

	/**
	 * 枚举名称
	 */
	public String enumName;

	/**
	 * 枚举实体类属性描述
	 *
	 * @return
	 */
	public String description;
	
	
	WorkDivisionIsEnabledEnum(String enumName, String description) {
		this.enumName = enumName;
		this.description = description;
	}
	
	WorkDivisionIsEnabledEnum(int code, String enumName, String description) {
		this.code = code;
		this.enumName = enumName;
		this.description = description;
	}
	
	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}
	
	public String getEnumName() {
		return enumName;
	}

	public void setEnumName(String enumName) {
		this.enumName = enumName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public static WorkDivisionIsEnabledEnum getEnumByCode(int enumCode) {
		WorkDivisionIsEnabledEnum[] values = WorkDivisionIsEnabledEnum.values();
		WorkDivisionIsEnabledEnum samplingEnum = null;

		for (WorkDivisionIsEnabledEnum value : values) {
			if (value.getCode() == enumCode) {
				samplingEnum = value;
			}
		}
		return samplingEnum;
	}

	public static WorkDivisionIsEnabledEnum getEnumByName(String enumName) {
		WorkDivisionIsEnabledEnum[] values = WorkDivisionIsEnabledEnum.values();
		WorkDivisionIsEnabledEnum repairEnum = null;

		for (WorkDivisionIsEnabledEnum value : values) {
			if (value.getEnumName() == enumName) {
				repairEnum = value;
			}
		}
		return repairEnum;
	}

	public static Map<Integer, String> getEnumByDescription() {
		Map<Integer, String> enumMap = new HashMap<>();

		WorkDivisionIsEnabledEnum[] values = WorkDivisionIsEnabledEnum.values();
		for (WorkDivisionIsEnabledEnum value : values) {
				enumMap.put(value.getCode(), value.getEnumName());
		}
		return enumMap;
	}

	public static Map<Integer, String> getEnumByDescription(String enumDescription) {
		Map<Integer, String> enumMap = new HashMap<>();

		WorkDivisionIsEnabledEnum[] values = WorkDivisionIsEnabledEnum.values();
		for (WorkDivisionIsEnabledEnum value : values) {
			if (Objects.equals(value.getDescription(), enumDescription)) {
				enumMap.put(value.getCode(), value.getEnumName());
			}
		}
		return enumMap;
	}
	
	public static Integer getCodeByEnumNameAndDescription(String enumName, String enumDescription) {
		WorkDivisionIsEnabledEnum[] values = WorkDivisionIsEnabledEnum.values();
		for (WorkDivisionIsEnabledEnum value : values) {
			if (Objects.equals(value.getDescription(), enumDescription)
					&& Objects.equals(value.getEnumName(), enumName)) {
				return value.getCode();
			}
		}
		return null;
	}

	
	public static List<Map<String, Object>> getEnumListByDescription(String enumDescription) {
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		WorkDivisionIsEnabledEnum[] values = WorkDivisionIsEnabledEnum.values();
		for (WorkDivisionIsEnabledEnum value : values) {
			if (Objects.equals(value.getDescription(), enumDescription)) {
				Map<String, Object> enumMap = new HashMap<String, Object>(2);
				enumMap.put("code", value.getCode());
				enumMap.put("name", value.getEnumName());
				list.add(enumMap);
			}
		}
		return list;
	}
}
